# Contributor: Oleg Titov <oleg.titov@gmail.com>
# Maintainer: Oleg Titov <oleg.titov@gmail.com>
pkgname=gx-go
pkgver=1.9.0
pkgrel=3
pkgdesc="A tool to use with the gx package manager for packages written in go"
url="https://github.com/whyrusleeping/gx-go"
arch="all"
license="MIT"
options="!check" # Test suite issues
makedepends="git glide go"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/whyrusleeping/$pkgname/archive/v$pkgver.tar.gz
	glide.yaml
	glide.lock
       "
builddir="$srcdir/src/github.com/whyrusleeping/$pkgname"

prepare() {
	export GOPATH="$srcdir"

	mkdir -p $(dirname $builddir)
	mv "$srcdir"/$pkgname-$pkgver "$builddir"/

	cd "$builddir"
	cp "$srcdir"/glide.yaml "$srcdir"/glide.lock .
	glide install --skip-test

	default_prepare
}

build() {
	GOPATH="$srcdir" GOBIN="$GOPATH/bin" make
}

package() {
	cd "$srcdir"
	install -Dm 755 bin/gx-go "$pkgdir/usr/bin/gx-go"

	cd "$builddir"
	install -Dm 644 -t "$pkgdir/usr/share/licenses/$pkgname/" LICENSE
}

glide_init() {
	abuild clean deps unpack prepare
	cd "$builddir"
	export GOPATH="$startdir"
	rm -f glide.yaml glide.lock
	glide init --non-interactive
	glide update
	cp glide.yaml glide.lock "$startdir"
	cd "$startdir" && abuild checksum clean
}

sha512sums="3df8a99d257098afdf99ba6cbf58d50eab196f823ae53db48865a4f4962e38b84a66ffc99d5a342b43ff9891c8245252a77677b75c770d86f93ef1ad3c9e879f  gx-go-1.9.0.tar.gz
db824fce3e8094e2806c68b18ba5b8decae4cb62068113f6bc97f72de1224bd326b3342297739ee9b5a86bd4f7c9ec2f9b04aa3610cc95903dc1b3bfd7b0934f  glide.yaml
32a2ae3e10d20c0ba1613a592d8b9fd7a6e9678e2bc9f262bb6887c22b65c0a8da2c7aef1f70d35b3d89ae6aa6b50ca26cdddd47c3ee274a8ddc1a8bf0b16016  glide.lock"
